# Copyright 2019 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#     http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

# NOTE: This file is auto generated by the elixir code generator program.
# Do not edit this file manually.

defmodule GoogleApi.CSS.V1.Model.CssProductInput do
  @moduledoc """
  This resource represents input data you submit for a CSS Product, not the processed CSS Product that you see in CSS Center, in Shopping Ads, or across Google surfaces.

  ## Attributes

  *   `attributes` (*type:* `GoogleApi.CSS.V1.Model.Attributes.t`, *default:* `nil`) - A list of CSS Product attributes.
  *   `contentLanguage` (*type:* `String.t`, *default:* `nil`) - Required. The two-letter [ISO 639-1](http://en.wikipedia.org/wiki/ISO_639-1) language code for the CSS Product.
  *   `customAttributes` (*type:* `list(GoogleApi.CSS.V1.Model.CustomAttribute.t)`, *default:* `nil`) - A list of custom (CSS-provided) attributes. It can also be used for submitting any attribute of the feed specification in its generic form (for example: `{ "name": "size type", "value": "regular" }`). This is useful for submitting attributes not explicitly exposed by the API, such as additional attributes used for Buy on Google.
  *   `feedLabel` (*type:* `String.t`, *default:* `nil`) - Required. The [feed label](https://developers.google.com/shopping-content/guides/products/feed-labels) for the CSS Product. Feed Label is synonymous to "target country" and hence should always be a valid region code. For example: 'DE' for Germany, 'FR' for France.
  *   `finalName` (*type:* `String.t`, *default:* `nil`) - Output only. The name of the processed CSS Product. Format: `accounts/{account}/cssProducts/{css_product}` "
  *   `freshnessTime` (*type:* `DateTime.t`, *default:* `nil`) - Represents the existing version (freshness) of the CSS Product, which can be used to preserve the right order when multiple updates are done at the same time. This field must not be set to the future time. If set, the update is prevented if a newer version of the item already exists in our system (that is the last update time of the existing CSS products is later than the freshness time set in the update). If the update happens, the last update time is then set to this freshness time. If not set, the update will not be prevented and the last update time will default to when this request was received by the CSS API. If the operation is prevented, the aborted exception will be thrown.
  *   `name` (*type:* `String.t`, *default:* `nil`) - The name of the CSS Product input. Format: `accounts/{account}/cssProductInputs/{css_product_input}`
  *   `rawProvidedId` (*type:* `String.t`, *default:* `nil`) - Required. Your unique identifier for the CSS Product. This is the same for the CSS Product input and processed CSS Product. We only allow ids with alphanumerics, underscores and dashes. See the [products feed specification](https://support.google.com/merchants/answer/188494#id) for details.
  """

  use GoogleApi.Gax.ModelBase

  @type t :: %__MODULE__{
          :attributes => GoogleApi.CSS.V1.Model.Attributes.t() | nil,
          :contentLanguage => String.t() | nil,
          :customAttributes => list(GoogleApi.CSS.V1.Model.CustomAttribute.t()) | nil,
          :feedLabel => String.t() | nil,
          :finalName => String.t() | nil,
          :freshnessTime => DateTime.t() | nil,
          :name => String.t() | nil,
          :rawProvidedId => String.t() | nil
        }

  field(:attributes, as: GoogleApi.CSS.V1.Model.Attributes)
  field(:contentLanguage)
  field(:customAttributes, as: GoogleApi.CSS.V1.Model.CustomAttribute, type: :list)
  field(:feedLabel)
  field(:finalName)
  field(:freshnessTime, as: DateTime)
  field(:name)
  field(:rawProvidedId)
end

defimpl Poison.Decoder, for: GoogleApi.CSS.V1.Model.CssProductInput do
  def decode(value, options) do
    GoogleApi.CSS.V1.Model.CssProductInput.decode(value, options)
  end
end

defimpl Poison.Encoder, for: GoogleApi.CSS.V1.Model.CssProductInput do
  def encode(value, options) do
    GoogleApi.Gax.ModelBase.encode(value, options)
  end
end
